const SingleEntryPlugin = require('./SingleEntryPlugin.js')

const itemToPlugin = function (context, item, name) {
  return new SingleEntryPlugin(context, item, name)
}

module.exports = class EntryOptionPlugin {
  apply(compiler) {
    compiler.hooks.entryOption.tap('EntryOption', (context, entry) => {
      itemToPlugin(context, entry, 'main').apply(compiler)
    })
  }
}
